﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;

namespace WeifenLuoWinFormDemo2
{
    public partial class BaseFrm : DockContent
    {
        //public bool IsOpened { get; set; }

        /// <summary>
        /// 定义窗口关闭事件
        /// </summary>
        public event EventHandler ChildFormClosed;


        public BaseFrm()
        {
            InitializeComponent();
            //IsOpened = true; 
        }

        protected virtual void OnChildFormClosed()
        {
            //IsOpened = false;
            ChildFormClosed?.Invoke(this, EventArgs.Empty);
        }

        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            base.OnFormClosing(e);
            if (e.CloseReason == CloseReason.UserClosing)
            {
                OnChildFormClosed();
            }
        }
    }
}
